package com.heima.apis.article;

import com.heima.apis.article.fallback.ArticleClientFallbackFactory;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.comment.dtos.CommentManageDto;
import com.heima.model.comment.dtos.CommentStatusDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * ClassName: IArticleClient
 * Description:
 * date: 2023/8/10 0010 18:20
 *
 * @author zHan
 */
@FeignClient(value = "leadnews-article", fallbackFactory = ArticleClientFallbackFactory.class)
public interface IArticleClient {

    /**
     * 保存app端相关文章
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/article/save")
    ResponseResult saveArticle(@RequestBody ArticleDto dto);

    /**
     * 查询文章配置
     * @param articleId
     * @return
     */
    @GetMapping("/api/v1/article/getArticleConfig/{articleId}")
    ResponseResult getArticleConfig(@PathVariable Long articleId);

    /**
     * 查询评论列表
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/article/getArticle")
    ResponseResult findNewsComments(@RequestBody CommentManageDto dto);

    /**
     * 修改文章配置
     * @param dto
     * @return
     */
    @PutMapping("/api/v1/article/updateArticleConfig")
    ResponseResult updateArticleConfig(@RequestBody CommentStatusDto dto);

    /**
     * 统计数量
     * @param map
     * @return
     */
    @PostMapping("/api/v1/article/getNewsDimension")
    ResponseResult getNewsDimension(@RequestBody Map<String, String> map);

    /**
     * 查询统计内容
     * @param map
     * @return
     */
    @PostMapping("/api/v1/article/getNewPage")
    ResponseResult getNewPage(@RequestBody Map<String, String> map);
}
